<template>
  <div class="home">
    <Top_nav class="son2"></Top_nav>

    <First class="son" style="margin:0 auto;"></First>
    <Second class="son son2"></Second>
    <Thired class="son son2"></Thired>
    <Fourth class="son son2"></Fourth>
    <Foot class="son"></Foot>

    <div @:click="fn" className="back_top" >
      <el-icon id="ivo">
        <Top  />
      </el-icon>
    </div>
  </div>
</template>


<script setup lang="ts">
import{ref,watch} from "vue"

 
import First from "./home_son/first.vue"
import Second from "./home_son/second.vue"
import Thired from "./home_son/thired.vue"
import Fourth from "./home_son/fourth.vue"
import Foot from "./home_son/foot.vue"
import Top_nav from "./home_son/top_nav.vue"

import { useRouter } from "vue-router";
let router = useRouter()


let y = ref(0),flag2:any=ref('none')
const onScroll = () => { y.value = document.documentElement.scrollTop }
window.addEventListener('scroll', onScroll, true)
watch(y,(newdata,olddata)=>{
  if(newdata<=400){
    flag2.value='none'
    console.log(">=",flag2.value)
  }else{
    flag2.value='block'
    console.log("<=",flag2.value)
  }
})

function fn(){
  window.scrollTo(0,0)
}
function getmsg(x) {
    // console.log("函数在HomeView.vue axios", x)
    // return

}



// import {getCurrentInstance} from 'vue'
// import store from "../../store/index"
// const Mystore=store()
// const {proxy}=getCurrentInstance()

import {getCurrentInstance} from 'vue'
import store from "../../store/index"
const Mystore=store()
const {proxy}=getCurrentInstance()




</script>

<style scoped lang="scss">

.home {
  height: 500px;
  background-image: url("./home_son/picture/picture1.webp");
  background-size: 100%;
  background-position: 0 -180px;
  background-repeat: no-repeat;
  background-color: #F2F3F5;

  // margin-bottom: 20px;
}

.son {
  width: 1180px;
  margin: 20px auto;
  border-radius: 2px;
}

.son2 {
  background-color: white;
}

.back_top {
  display: inline-block;
  position: fixed;
  right: 5%;
  bottom: 3%;
  box-sizing: border-box;
  width: 54px;
  height: 54px;
  background-color: #00c792;
  text-align: center;
  padding-top: 12px;

  font-size: 30px;
  font-weight: 700;

  display: v-bind(flag2);
}

#ivo{
    color: white !important;
  }

</style>
